import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
import { CommonEntity } from '~/common/entity/common.entity';
import { ArticleContentEntity } from '../article-content.entity';
import { UserEntity } from '~/modules/user/user.entity';

@Entity({ name: 'ah_article_content_collect' })
@Index(['id'])
export class ArticleContentCollectEntity extends CommonEntity {
  @ManyToOne(() => ArticleContentEntity, (content) => content.contentCollects)
  @JoinColumn({ name: 'content_id' })
  content: ArticleContentEntity;

  @ManyToOne(() => UserEntity, (user) => user.contentCollects)
  @JoinColumn({ name: 'user_id' })
  user: UserEntity;

  // 备注
  @Column({ type: 'text', comment: '备注', nullable: true })
  remark: string;
}
